import 'package:flutter/material.dart';

class EmptyWidget extends StatelessWidget {
  final String status;
  final String buttonText;
  final bool isShowImage;
  final VoidCallback? onTap;

  const EmptyWidget({
    super.key,
    this.status = "",
    this.buttonText = "",
    this.isShowImage = true,
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      mainAxisAlignment: MainAxisAlignment.center,
      children: <Widget>[
        if (isShowImage) Image.asset('assets/images/status/empty.png'),
        const SizedBox(height: 20.0),
        Text(
          status,
          style: const TextStyle(
            fontSize: 14.0,
            color: Color(0xFF888888),
            fontFamily: 'Regular',
            fontWeight: FontWeight.w300,
          ),
        ),
        const SizedBox(height: 20.0),
        if (buttonText.isNotEmpty)
          TextButton(
            style: TextButton.styleFrom(
              padding: const EdgeInsets.symmetric(horizontal: 41.0),
              textStyle: const TextStyle(
                fontSize: 18.0,
                fontWeight: FontWeight.bold,
                color: Color(0xFF262626), // 也可以在这里设置文本颜色
              ),
            ),
            onPressed: () {
              onTap?.call();
            },
            child: Container(
              height: 44.0,
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: <Widget>[
                  Text(
                    buttonText,
                    style: const TextStyle(
                      fontSize: 17.0,
                      color: Colors.white,
                      fontFamily: 'Regular',
                      fontWeight: FontWeight.w300,
                      height: 1.0,
                    ),
                  )
                ],
              ),
            ),
          ),
        const SizedBox(height: 80.0),
      ],
    );
  }
}
